import request from './request.js';

export const getItems = () => request({
    method: 'get',
    url: '/items',
});

// 信息回填
export const getItem = (id) => request({
    method: 'get',
    url: `/items/${id}`,
});

export const addItem = (data) => request({
    method: 'post',
    url: '/items',
    data,
});

export const deleteItem = (id) => request({
    method: 'delete',
    url: `/items/${id}`,
});

export const editItem = (id, data) => request({
    method: 'put',
    url: `/items/${id}`,
    data,
});

export const exist = (params) => request({
    method: 'get',
    url: '/items/exist',
    params,
});

export const sortItem = (firstId,secondId) => request({
    method:'put',
    url:`/items/sort/${firstId}/${secondId}`
})